import asyncio
import httpx
from data import bark_ids


async def notify_one(client, bark_id, msg):
    url = "https://api.day.app/{0}/{1}/".format(bark_id, msg)
    await client.get(url)


async def notify_all(msg):
    async with httpx.AsyncClient() as client:
        tasks = []
        for bark in bark_ids:
            routine = notify_one(client, bark, msg)
            tasks.append(asyncio.ensure_future(routine))
        await asyncio.gather(*tasks)
